package com.sg.dto.integration.framework;

import com.sg.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;

@Data
public class ObjAttributeIdDto extends BaseDto implements Serializable {

    /**
     * 业务对象编码:
     */
    @NotNull(message = "业务对象编码不能为空")
    @ApiModelProperty("业务对象编码")
    private String objectCode;

    /**
     * 对象属性编码:
     */
    @NotNull(message = "对象属性编码不能为空")
    @ApiModelProperty("对象属性编码")
    private String propertyCode;

    /**
     * 主键ID:
     */
    @NotNull(message = "主键ID不能为空")
    @ApiModelProperty("主键ID")
    private String uniqueId;

    /**
     * 排序数字:
     */
    @NotNull(message = "排序数字不能为空")
    @ApiModelProperty("排序数字")
    private Long number;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        ObjAttributeIdDto that = (ObjAttributeIdDto) o;
        return (
                objectCode == that.objectCode &&
                        propertyCode == that.propertyCode &&
                        uniqueId == that.uniqueId &&
                        number == that.number
        );
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                super.hashCode(),
                objectCode,
                propertyCode,
                uniqueId,
                number
        );
    }

}
